//生成器函数
function* foo() {
  console.log("start");
  try {
    const res = yield "foo";
    console.log(res);
    yield "fooo";
  } catch (e) {
    console.log(e);
  }
}
const generator = foo();

const r = generator.next();
console.log(r);
generator.next("bar");

// generator.throw(new Error("Generator error"));
